<template>
  <block v-for="(item,index) in list" :key="item.id">
    <custom-item :item="item"></custom-item>
  </block>
  <view class="add-btn" @click="$u.route('/pages/houseMine/newCustom')">新增客户</view>
</template>

<script setup>
  import { onShow, onReachBottom } from '@dcloudio/uni-app';
  import { custom_lst } from '../../config/api';
  import customItem from './components/custom-item.vue';
  import { ref } from 'vue';
  const params = ref({
    page: 1,
    limit: 15
  })
  const list = ref([])
  onShow(() => {
    _custom_lst()
  })
  onReachBottom(() => {
    params.value.page++
    _custom_lst()
  })
  // 客户列表
  const _custom_lst = () => {
    custom_lst(params.value).then(res => {
      if (params.value.page == 1) list.value = res.data.data
      else list.value = list.value.concat(res.data.data)
    })
  }
</script>

<style lang="scss" scoped>
  .add-btn {
    height: 90rpx;
    background: #F87610;
    border-radius: 50rpx;
    margin: 30rpx;
    bottom: env(safe-area-inset-bottom);
    position: fixed;
    left: 0;
    right: 0;
    font-size: 30rpx;
    color: #fff;
    text-align: center;
    line-height: 90rpx;
  }
</style>